import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementPlus from "element-plus";
// import cache from "@/utils/cache.js";
import "element-plus/dist/index.css";
// import mapMenusToRoutes from "@/utils/map-menus";
import { ElMessage } from "element-plus";
import zhCn from "element-plus/es/locale/lang/zh-cn";
// const userMenu = cache.getCache("userMenu");
const app = createApp(App);
app.use(store);

// const routes = mapMenusToRoutes(userMenu);

// routes.forEach((route) => {
//   router.addRoute("main", route);
// });
app.use(router);
app.config.globalProperties.$toast = (message, type) => {
  ElMessage({
    message,
    type,
  });
};

app.mount("#app");

app.use(ElementPlus, {
  locale: zhCn,
});
